<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <router-link to="/home">home</router-link>
        <router-link to="/obj">obj</router-link>
        <router-link to="/color">color</router-link>
        <router-view></router-view>
    </div>
</body>

<script src="./vue.js"></script>
<script src="./vue-router.js"></script>
<script>
    let home = {
        template:"<div>home</div>"
    };
    let obj = {
        template:"<div>obj</div>"
    };
    let color = {
        template:"<div>color</div>"
    }

    let router = new VueRouter({
        routes:[
            {
                path:'/',
                redirect:home
            },
            {
                path:'/home',
                component:home
            },
            {
                path:'/obj',
                component:obj
            },
            {
                path:'/color',
                component:color
            }
        ]
    })
    let vm = new Vue({
        el:"#app",
        router
    })
</script>
</html>